package cn.itcast.consumer;

import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.springframework.stereotype.Service;

@Service
public class SmsConsumer implements MessageListener{

	@Override
	public void onMessage(Message message) {
		MapMessage mapMessage = (MapMessage) message;
		try {
			String telephone = mapMessage.getString("telephone");
			String content = mapMessage.getString("content");
			//String result = SmsUtils.sendSmsByHTTP(telephone, content);
			System.out.println(telephone);
			System.out.println(content);
			String result = "000x";
			
			if(result.startsWith("000")){
				System.out.println("发送成功");
			}else{
				System.out.println("发送失败");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
